//
//  ViewController.swift
//  ChinesePinyinSort
//
//  Created by safiriGitHub on 08/17/2020.
//  Copyright (c) 2020 safiriGitHub. All rights reserved.
//

import UIKit
import ChinesePinyinSort

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
       
        let a = "百度".pinyinForSort()
        print("百度不要音调，不是姓名--\(a)")
        let b = "百度".pinyinForSort(isForSurname: false, withYindiao: true)
        print("百度要音调，不是姓名--\(b)")
        let c = "翟天龙".pinyinForSort(isForSurname: false, withYindiao: true)
        print("翟天龙要音调，不是姓名--\(c)")
        let d = "翟天龙".pinyinForSort(isForSurname: true, withYindiao: true)
        print("翟天龙要音调，是姓名--\(d)")
        let e = "翟天龙".pinyinForSort(isForSurname: true, withYindiao: false)
        print("翟天龙要音调，是姓名--\(e)")

        "中国共产党万岁！".forEach { (s) in
            let str = "\(s)".firstLetters()
            print("\(s)首字母为\(str)")
            
        }
        for s in "仇千人" {
            let str = "\(s)".firstLetters()
            print("\(s)首字母为\(str)")
        }
        for s in "仇千人" {
            let str = "\(s)".firstLetters(isForSurname: true)
            print("\(s)首字母为\(str)")
        }
         
    /* example
         百度不要音调，不是姓名--bai du
         百度要音调，不是姓名--bǎi dù
         翟天龙要音调，不是姓名--dí tiān lóng
         翟天龙要音调，是姓名--zhái tiān lóng
         翟天龙要音调，是姓名--zhai tian long

         中首字母为Z
         国首字母为G
         共首字母为G
         产首字母为C
         党首字母为D
         万首字母为W
         岁首字母为S
         ！首字母为#
         仇首字母为C
         千首字母为Q
         人首字母为R
         仇首字母为q
         千首字母为Q
         人首字母为R

         */
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

